import request from '@/utils/request'

// 查询公司所有部门
export function getDepartmentList() {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

// 新增部门
export function addDepartments({ code, introduce, manager, name, pid }) {
  return request({
    url: '/company/department',
    method: 'post',
    data: {
      code,
      introduce,
      manager,
      name,
      pid
    }
  })
}
// 删除部门
export function delDepartments({ id }) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
// 查询部门详情
export function getDepartmentById({ id }) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
// 编辑部门
export function updDepartments({ code, introduce, manager, name, id, pid }) {
  return request({
    url: `/company/department/${id}`,
    method: 'put',
    data: {
      code,
      introduce,
      manager,
      name,
      pid
    }
  })
}
